struct ListNode* ReverseList(struct ListNode* head) {
    // write code here
    int size = 0, top = -1;
    struct ListNode* head1 = head;
    while (head) {
        size++;
        head = head->next;
    }
    struct ListNode* Stack[size];
    while (head1) {
        Stack[++top] = head1;
        head1 = head1->next;
    }
    struct ListNode* phead = Stack[top];
    struct ListNode* p = phead;
    while (top != 0) {
        p->next = Stack[--top];
        p = p->next;
    }
    p->next = NULL;
    return phead;
}